package com.origin.app

import ImageMatcher
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.origin.utils.image.ImageLoader
import kotlinx.android.synthetic.main.activity_open_cv_page.img
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

class OpenCvPage : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_open_cv_page)
        // /storage/self/primary/Pictures/Screenshots/Screenshot_2024-08-09-15-44-05-59_b783bf344239542886fee7b48fa4b892.jpg
var urlFile = "/storage/self/primary/Pictures/Screenshots/Screenshot_2024-08-09-15-44-05-59_b783bf344239542886fee7b48fa4b892.jpg"
        ImageLoader.loaderImgFile(img.context, urlFile, R.drawable.ic_launcher_background, R.drawable.ic_launcher_background).into(img)
        img.setOnClickListener{
            s1();
        }

    }

     fun s1(){
        GlobalScope.launch {
            withContext(Dispatchers.IO){
                val largeImagePath="/storage/self/primary/Pictures/Screenshots/Screenshot_2024-08-09-15-44-05-59_b783bf344239542886fee7b48fa4b892.jpg"
                val smallImagePath="/storage/self/primary/Pictures/Screenshots/asd.jpg"
                ImageMatcher.findTemplateInImage(largeImagePath,smallImagePath)
            }
        }

    }
}